<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>推送</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />

</head>
<body>

<div class="formbody">

    <div class="formtitle">
        <span >发送通知</span>
    </div>


    <ul class="forminfo">

        <li id="liClass" ><label>消息类型</label>
            <select id="drpMc" name="drpMc" lay-filter="drpMc" style="width: 500px ; height:30px"  class="scinput">>
                <option th:each="meassge_class,iterStat : ${meassge_class_list}"
                        th:value="${meassge_class.id}"
                        th:text="${meassge_class.meassge_classname}"></option>
            </select>
        </li>


        <li><label>通知内容</label><textarea class="textinput" name="txtMemo" rows="2" cols="5" id="txtMemo"
                                         th:inline="text" style="height:200px;width:500px;resize:none"></textarea>
        </li>


        <li><label>消息跳转链接</label>
            <input type="text" id="txtMsgUrl" name="txtMsgUrl" class="dfinput" style="width:500px" />
        </li>

        <!--<li disabled="false"><label>推送跳转链接</label>-->
            <!--<input type="text" id="txtPushUrl" name="txtPushUrl" class="dfinput" style="width:500px" />-->
        <!--</li>-->

        <li><label>&nbsp;</label>
            <input type="hidden" id="hideUserId" th:value="${user_id}" />
            <input type="button" id="btnSave" class="btn" value="保存" />
        </li>
    </ul>
</div>


</body>
<script type="text/javascript" src="js/jquery.js"></script>
<link href="plugin/artDialog/artDialog/skins/blue.css" rel="stylesheet" />
<script src="plugin/artDialog/artDialog/artDialog.min.js" type="text/javascript"></script>
<script src="plugin/artDialog/artDialog/artDialog.plugins.min.js" type="text/javascript"></script>
<script src="plugin/artDialog/dialog.js" type="text/javascript"></script>
<script>
    /*<![CDATA[*/


    function push(userId,meassge_classId,txtMemo,msgUrl) {

        $.ajax({
            url: 'pushMeassge',
            type: 'POST',
            data: {
                'userId' :userId,
                'meassge_classId' :meassge_classId,
                'meassge_content': txtMemo,
                'msgUrl': msgUrl
            },
            dataType: 'json',
            success: function (data) {
                if (data.status == '0') {
                    showNotice('保存成功');
                    location.href = 'userlist.html';
                } else {
                    showNotice(data.msg);
                }
            }
        });

    }

    $(function () {
        $('#btnSave').click(function () {
            var meassge_classId = $('#drpMc').val();
            var txtMemo = $('#txtMemo').val();
            var  userId=$('#hideUserId').val();
            var  msgUrl=$('#txtMsgUrl').val();
//            var  pushUrl=$('#txtPushUrl').val();


            console.log(userId);
            if (meassge_classId == '' || txtMemo == '') {
                alert('请填写完整信息');
                return false;
            }


                push(userId,meassge_classId,txtMemo,msgUrl);



        })
    });


    /*]]>*/
</script>
</html>